//文章分类
//导入express
const express = require("express")
const {getArtCate, addArtCate, deleteCate, getCateById, updateCate} = require("../router-handler/artcate");
//导入校验规则的包
const expressJoi = require("@escook/express-joi");
const {artcate_delete_schema, artcate_get_schema, artcate_add_schema, artcate_update_schema} = require("../schema/artcate");
//实例化Router对象
const router = express.Router();

//定义获取文章类别接口
router.get("/cates", getArtCate)

//定义添加文章类别接口
router.post("/add",expressJoi(artcate_add_schema),addArtCate)

//定义删除文章类别接口
router.get("/delete/:id",expressJoi(artcate_delete_schema),deleteCate)

//定义根据id获取分类
router.get("/cateById/:id",expressJoi(artcate_get_schema),getCateById)

//定义更新类别接口
router.post("/update",expressJoi(artcate_update_schema),updateCate)



//向外提供router对象
module.exports = router;

